package org.oms.wechater.utils;

import org.oms.wechater.message.corp.QiYeFileMsg;
import org.oms.wechater.message.corp.QiYeImageMsg;
import org.oms.wechater.message.corp.QiYeMpNewsMsg;
import org.oms.wechater.message.corp.QiYeNewsMsg;
import org.oms.wechater.message.corp.QiYeTextMsg;
import org.oms.wechater.message.corp.QiYeVideoMsg;
import org.oms.wechater.message.corp.QiYeVoiceMsg;
import org.oms.wechater.pojo.Result;


public class QiYeMsgUtil {
	
	/**
	 * 文本消息
	 * @param text
	 * @return
	 */
	public static Result<String> sendTextMsg(String token,QiYeTextMsg text) {
		String jsonStr = JsonUtil.toJson(text);
		return QiYeUtil.sendMessage(token,jsonStr);
	}
	
	/**
	 * 图片消息
	 * @param image
	 * @return
	 */
	public static Result<String> sendImageMsg(String token,QiYeImageMsg image) {
		String jsonStr = JsonUtil.toJson(image);
		return QiYeUtil.sendMessage(token,jsonStr);
	}
	
	/**
	 * 语音消息
	 * @param voice
	 * @return
	 */
	public static Result<String> sendVoiceMsg(String token,QiYeVoiceMsg voice) {
		String jsonStr = JsonUtil.toJson(voice);
		return QiYeUtil.sendMessage(token,jsonStr);
	}
	
	/**
	 * 视频消息
	 * @param video
	 * @return
	 */
	public static Result<String> sendVideoMsg(String token,QiYeVideoMsg video) {
		String jsonStr = JsonUtil.toJson(video);
		return QiYeUtil.sendMessage(token,jsonStr);
	}
	
	/**
	 * （图文混排的消息
	 * @param news
	 * @return
	 */
	public static Result<String> sendNewsMsg(String token,QiYeNewsMsg news) {
		String jsonStr = JsonUtil.toJson(news);
		return QiYeUtil.sendMessage(token,jsonStr);
	}
	
	/**
	 * 多图文混排的消息
	 * @param mpNews
	 * @return
	 */
	public static Result<String> sendMpNewsMsg(String token,QiYeMpNewsMsg mpNews) {
		String jsonStr = JsonUtil.toJson(mpNews);
		return QiYeUtil.sendMessage(token,jsonStr);
	}
	
	/**
	 * 文件消息
	 * @param file
	 * @return
	 */
	public static Result<String> sendFileMsg(String token,QiYeFileMsg file) {
		String jsonStr = JsonUtil.toJson(file);
		return QiYeUtil.sendMessage(token,jsonStr);
	}
}
